﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using IMDBApi.Contracts;
using IMDBApi.Contracts.Entities;
using IMDBApi.Contracts.Entities.Title.MainDetail;
using IMDBApi.Contracts.Entities.Title.Photos;
using IMDBApi.Contracts.Entities.Title.PlotSummary;
using IMDBApi.Contracts.Entities.Title.Quotes;
using IMDBApi.Contracts.Entities.Title.Synposis;
using IMDBApi.Contracts.Entities.Title.Trivia;
using IMDBApi.Contracts.Entities.Title.UserReviews;
using IMDBApi.Contracts.Entities.Title.FullCredits;
using IMDBApi.Contracts.Entities.Title.Episodes;
using IMDBApi.Contracts.Entities.Title.ExternalReviews;
using IMDBApi.Contracts.Entities.Search;

namespace IMDBApi.Tests.UnitTest
{
    [TestClass]
    public class UnitTestMovie
    {
        [TestMethod]
        public void TestIMDBFullCredits()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetFullCredits();
            FullCredits fullCredits = JSONSerializer.Deserialize<FullCredits>(json);

            Assert.IsNotNull(fullCredits.Data);
        }

        [TestMethod]
        public void TestIMDBEpisodes()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetEpisodesBySeason();
            Episodes episodes = JSONSerializer.Deserialize<Episodes>(json);

            Assert.IsNotNull(episodes.Data);
        }

        [TestMethod]
        public void TestIMDBExternalReviews()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetExternalReviews();
            ExternalReviews externalReviews = JSONSerializer.Deserialize<ExternalReviews>(json);

            Assert.IsNotNull(externalReviews.Data);
        }

        [TestMethod]
        public void TestIMDBMovieMainDetails()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetMainDetails();
            MainDetail mainDetail = JSONSerializer.Deserialize<MainDetail>(json);

            Assert.IsNotNull(mainDetail.Data);
        }

        [TestMethod]
        public void TestIMDBMovieParentalGuide()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetParentalGuide();
            MainDetail mainDetail = JSONSerializer.Deserialize<MainDetail>(json);

            Assert.IsNotNull(mainDetail.Data);
        }

        [TestMethod]
        public void TestIMDBPhotos()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetPhotos();
            Photos photos = JSONSerializer.Deserialize<Photos>(json);

            Assert.IsNotNull(photos.Data);
        }

        [TestMethod]
        public void TestIMDBPlotSummary()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetPlotSummary();
            PlotSummary plotSummary = JSONSerializer.Deserialize<PlotSummary>(json);

            Assert.IsNotNull(plotSummary.Data);
        }

        [TestMethod]
        public void TestIMDBQuotes()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetQuotes();
            Quotes plotSummary = JSONSerializer.Deserialize<Quotes>(json);

            Assert.IsNotNull(plotSummary.Data);
        }

        [TestMethod]
        public void TestIMDBSynopsis()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetSynopsis();
            Synopsis synposis = JSONSerializer.Deserialize<Synopsis>(json);

            Assert.IsNotNull(synposis.Data);
        }

        [TestMethod]
        public void TestIMDBTrivia()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetTrivia();
            Trivia trivia = JSONSerializer.Deserialize<Trivia>(json);

            Assert.IsNotNull(trivia.Data);
        }

        [TestMethod]
        public void TestIMDBUserReviews()
        {
            string json = new IMDBMovie("http://www.imdb.com/title/tt0499549/").GetUserReviews();
            UserReviews userReviews = JSONSerializer.Deserialize<UserReviews>(json);

            Assert.IsNotNull(userReviews.Data);
        }
    }
}
